/***************************************************************************
创建者：华磊
 开始时间：               : 2020.1１.09
 copyright            : (C) 深圳市华友高科有限公司
 修改说明：（每次有修改就添加一条，带有 修改人，修改时间，修改描述）

 ***************************************************************************
 *   右侧自定义功能视窗对话框
*                                                                         *
 ***************************************************************************/
#include "rightfun.h"
#include "ui_rightfun.h"


RightFun::RightFun(int styleId,QWidget *parent) :
    QWidget(parent),
    ui(new Ui::RightFun)
{
    ui->setupUi(this);

    setGeometry(rect().x()+525, rect().y()+565,70, 275);

    initialDisplayStyle(styleId);

}

void RightFun::initialDisplayStyle(int styleId)
{

    switch (styleId) {
    case 1:
        //ui->pushButton_2->setGeometry(15,70,51,47);
        ui->pushButton_2->hide();
        ui->pushButton_3->hide();
        break;
    default:
        break;
    }
}

RightFun::~RightFun()
{
    delete ui;
}

void RightFun::on_pushButton_clicked()
{
    emit rightFunEmpty1_signal();
}

void RightFun::on_pushButton_2_pressed()
{
    emit rightFunEmpty2_signal();
}

void RightFun::on_pushButton_2_released()
{
    emit rightStopRunSignal();
}

void RightFun::on_pushButton_3_pressed()
{
    emit rightFunEmpty3_signal();
}

void RightFun::on_pushButton_3_released()
{
    emit rightStopRunSignal();
}

//void RightFun::updateView()
//{
//    ui->pushButton->setText(button1Text);
//    ui->pushButton->setStyleSheet(QString("border-image: url(%1);").arg(button1PictureAddress));
//    ui->pushButton_2->setText(button2Text);
//    ui->pushButton_2->setStyleSheet(QString("border-image: url(%1);").arg(button2PictureAddress));
//    ui->pushButton_3->setText(button3Text);
//    ui->pushButton_3->setStyleSheet(QString("border-image: url(%1);").arg(button3PictureAddress));
//}

void RightFun::changeLanguage(int language)
{
    if(1 == language)
    {
        translator.load("/agvwork/AgvHmi/baseBag/hmiProject/language/rightFunEnglishLan.qm");
        qApp->installTranslator(&translator);
    }
    else
    {
        qApp->removeTranslator(&translator);
    }
    ui->retranslateUi(this);
}
